package tech.eyao.hs60x.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import tech.eyao.hs60x.dto.BaseResult;
import tech.eyao.hs60x.dto.StepDTO;
import tech.eyao.hs60x.service.HealthService;
import tech.eyao.hs60x.utils.TokenUtils;

@RestController
@RequestMapping("/health")
@Api("健康相关")
public class HealthController {
    @Autowired
    private HealthService       healthService;

    @PostMapping("/upload.do")
    @ApiImplicitParam(name = "setp", value = "上传步数", required = true, dataType = "Integer")
    @ApiOperation(value = "手表端-上传步数")
    public BaseResult uploadStepNumber(@RequestParam("setp") Integer setpNumber) {
          return healthService.uploadStepNumber(TokenUtils.getUserId(), setpNumber);
    }

    @PostMapping(path = "/getSetp.do")
    @ApiOperation(value = "手表端-获取步数",response=StepDTO.class)
    public BaseResult getUserSetp() {
    	return healthService.getUserStep(TokenUtils.getUserId());
    }
    
    @PostMapping(path = "/topList.do")
    @ApiOperation(value = "手表端-排行榜",response=StepDTO.class)
    public BaseResult topList() {
    	return healthService.topList(TokenUtils.getUserId());
    }
    
    
    @PostMapping(path = "/favour.do")
    @ApiOperation(value = "手表端-排行榜点赞")
    public BaseResult favour(@ApiParam("好友账户ID")long friendWatchId) {
    	return healthService.favour(TokenUtils.getUserId(),friendWatchId);
    }
}
